package com.googlecode.delivery.model;

import java.io.File;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

/**
 * Marker class on Properties file dedicated to environment properties file.
 * 
 * @author kst
 * 
 */
@SuppressWarnings("serial")
public class Environment extends Properties {

	private String name;
	private File envFile = null;

	/**
	 * @param name
	 */
	public Environment(String name) {
		this.name = name;
	}

	public File getEnvFile() {
		return envFile;
	}

	public void setEnvFile(File envFile) {
		this.envFile = envFile;
	}

	/**
	 * @return
	 */
	public String getName() {
		return name;
	}

	/**
	 * Creates a Map with key/values.
	 * 
	 * @return Map instance.
	 */
	public Map<String, String> toMap() {
		Map<String, String> propertyMap = new HashMap<String, String>();
		for (Enumeration<?> iterator = super.keys(); iterator.hasMoreElements();) {
			String key = (String) iterator.nextElement();
			propertyMap.put(key, null);
		}
		return propertyMap;
	}
}
